Final Project

Adam Guenoun, Indira Martinez, Nicholas Solis

Introduction:

Within this analysis, we’ll investigate factors correlated to diabetes. With a data set of 100,000 people, this investigation allows us to display relations between ages, HbA1c levels, smoking history, and glucose levels. With a wide range of data points, we begin to question if there are trends within this data that match our general understanding of diabetes. Our goal is to asses which of the 9 variables play a stronger role to the development of diabetes and if we can prove trends to better support our assumptions of this data. Through data visualization, chart analysis, and numerical analysis we will be able to present this data to convicne a general audience of the important factors that contribute to diabteic trends.

library(tidyverse) ## Loaded for dplyr
library(ggplot2) ## Loaded for plotting
library(plotly) ## Loaded for interactive plots
library(readr) ## Loaded to read in data
library(knitr) ## Loaded to compute and display data
library(scales) ## Loaded to scale data 

Diabetes Dataset

100,000 × 9 (first 6 rows)
gender age hypertension heart_disease smoking_history bmi HbA1c_level blood_glucose_level diabetes
Female 80 0 1 never 25.19 6.6 140 0
Female 54 0 0 No Info 27.32 6.6 80 0
Male 28 0 0 never 27.32 5.7 158 0
Female 36 0 0 current 23.45 5.0 155 0
Male 76 1 1 current 20.14 4.8 155 0
Female 20 0 0 never 27.32 6.6 85 0

Male vs. Female Blood Sugar Levels (HbA1c) Plot

For this part we will focus only on the HbA1c levels for males and females.

Overall, blood sugar regulation patterns appear balanced between both genders.

99,982 x 4 (first 5 rows)
gender diabetes HbA1c_level HbA1c_category
Female 0 6.6 Diabetic ≥ 6.5%
Female 0 6.6 Diabetic ≥ 6.5%
Male 0 5.7 Prediabetic 5.7% - 6.4%
Female 0 5.0 Normal < 5.7%
Male 0 4.8 Normal < 5.7%
6 x 4 (first 5 rows)
gender HbA1c_category n percent
Female Diabetic ≥ 6.5% 11835 20.21280
Female Normal < 5.7% 22492 38.41372
Female Prediabetic 5.7% - 6.4% 24225 41.37348
Male Diabetic ≥ 6.5% 8959 21.62443
Male Normal < 5.7% 15358 37.06976

Age Distribution in Diabetes, Heart Disease, and Hypertension Plot

358 x 5 (first 5 rows)
age diabetes heart_disease hypertension group
57 1 1 1 Diabetes, H.D, and Hyp.
62 1 1 1 Diabetes, H.D, and Hyp.
62 1 1 1 Diabetes, H.D, and Hyp.
67 1 1 1 Diabetes, H.D, and Hyp.
72 1 1 1 Diabetes, H.D, and Hyp.
81,885 x 5 (first 5 rows)
age heart_disease diabetes hypertension group
54 0 0 0 Free of Diabetes, H.D, and Hyp.
28 0 0 0 Free of Diabetes, H.D, and Hyp.
36 0 0 0 Free of Diabetes, H.D, and Hyp.
20 0 0 0 Free of Diabetes, H.D, and Hyp.
79 0 0 0 Free of Diabetes, H.D, and Hyp.

BMI Distribution by Hypertension Status Plot

The graph below is separated by whether or not a person has hypertension. With the comparison of BMI as the range, it’s seen that majority of people with and without hypertension lie within a BMI range of 25-29. Notice that for people with hypertension, the desnity population above the red line is greater than that of people without hypertension; indicating that there’s a larger of population of people with hypertension that have a larger BMI
Outliers or extreme values might appear as small bulges or extended tails at the ends of the chart, showing individuals with very high or low BMI.

10,000 x 9 (first 5 rows)
gender age hypertension heart_disease smoking_history bmi HbA1c_level blood_glucose_level diabetes
Female 80 0 1 never 25.19 6.6 140 0
Female 54 0 0 No Info 27.32 6.6 80 0
Male 28 0 0 never 27.32 5.7 158 0
Female 36 0 0 current 23.45 5.0 155 0
Male 76 1 1 current 20.14 4.8 155 0

The graph below is separated by whether or not a person has hypertension. With the comparison of BMI as the range, it’s seen that majority of people with and without hypertension lie within a BMI range of 25-29. Notice that for people with hypertension, the desnity population above the red line is greater than that of people without hypertension; indicating that there’s a larger of population of people with hypertension that have a larger BMI

Blood Glucose Levels by Diabetes Status (age 3-80) Plot

96,713 x 3 (first 5 rows)
age diabetes blood_glucose_level
80 No Diabetes 140
54 No Diabetes 80
28 No Diabetes 158
36 No Diabetes 155
76 No Diabetes 155

BMI vs. Age Across Diabetes & Heart Disease Plot

8,500 x 4 (first 5 rows)
age bmi diabetes condition
44 19.31 1 Diabetes Only
67 27.32 1 Diabetes Only
50 27.32 1 Diabetes Only
73 25.91 1 Diabetes Only
53 27.32 1 Diabetes Only
3,942 x 4 (first 5 rows)
age bmi heart_disease condition
80 25.19 1 Heart Disease Only
76 20.14 1 Heart Disease Only
72 27.94 1 Heart Disease Only
67 27.32 1 Heart Disease Only
77 32.02 1 Heart Disease Only

A relation to BMI and Heart Disease

Each person within this scale has heart disease. Here a comparison is made between declared underweight and overweight people, grouped by sex, based on a BMI scale. There’s a significant increase in population percentage for those who are considered overweight and that have heart disease. With visual aid, it can be concluded that as weight increases, chances of heart disease will increase.

An excpetion?

The data here is heavily dependent on BMI scale. It is important to note that BMI is not really a great determination for those who have diabetes, but there is a general trend within the data that people who have a BMI over 30 are more likely to be diabetic.

A relation to hypertension?

This depicts the different categories of HbA1c levels and their relation to patients hypertension status

Diabetic range for men

This graph shows the population density of men based on diabetes status, based on age range

Diabetic range for women

This graph shows the population density of women based on diabetes status, based on age range